#define NULL ((void*)0)

// buffer sizes
#define CMD_BUF_SIZE 16
#define LOOP_BUF_SIZE 10
#define IO_BUF_SIZE 16

// timer 3 constant
#define TIMER3_COUNTDOWN    50800

// timer 4 definitions
#define TIMER4_LVAL 0x80810060
#define TIMER4_HVAL 0x80810064
  #define T4EN_MASK 0x100
#define TIMER4_TICKS_PER_MS 983

// command constants
#define TRAIN_SOLENOID_OFF  0x20
#define TRAIN_SW_STRAIGHT   0x21
#define TRAIN_SW_CURVED     0x22
#define TRAIN_GO            0x60
#define TRAIN_STOP          0x61
#define TRAIN_SENSORS_BASE  0x80
#define TRAIN_SENSOR_BASE   0xc0

// other train set constants
#define NUM_SENSOR_MODULES  5

// reading VIC (vectored interrupt controller)
// so far, we just have the definitions for Timer 3
#define VIC1_BASE           0x800b0000
#define VIC2_BASE           0x800c0000
#define IRQ_STATUS_OFFSET   0x00000000    // 32 bits, RO
#define FIQ_STATUS_OFFSET   0x00000004    // 32 bits, RO
#define INT_SELECT_OFFSET   0x0000000c    // 32 bits, RW
#define INT_ENABLE_OFFSET   0x00000010    // 32 bits, RW
    #define TC3OI_MASK      (0x1<<(51-32))

// terminal colors
#define FG_BASE   30
#define BG_BASE   40

#define BLACK_OFFSET    0
#define RED_OFFSET      1
#define GREEN_OFFSET    2
#define YELLOW_OFFSET   3
#define BLUE_OFFSET     4
#define MAGENTA_OFFSET  5
#define CYAN_OFFSET     6
#define WHITE_OFFSET    7
